UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fOXyJ9hn3G9C2ORwG+mg+5Q3/02hMG/fhWfU0NmHl9k='
WHERE
key_id = '38114abea1f774a51529a322d2cedf69acde06b691f7d14df73726e8e971f7dd'
AND (
token = 'fOXyJ9hn3G9C2ORwG+mg+5Q3/02hMG/fhWfU0NmHl9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)