UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IUSAw7H7WJ/bPYGC0o1UwtBvAUc1iZlEgpsAgFRsWDs='
WHERE
key_id = 'c52c3a03015909f4df167869c17fb32b5d32b0d8bdcae9b8396a29ace71ed662'
AND (
token = 'IUSAw7H7WJ/bPYGC0o1UwtBvAUc1iZlEgpsAgFRsWDs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)