UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MjPspuUjEKBE9/AVAnPWCu7CIYizgDZrV4VtmUZtBis='
WHERE
key_id = '4250763f0ab31d3d4d0854b0cfcba7dc18da04f38811a808191fe4b788163fe1'
AND (
token = 'MjPspuUjEKBE9/AVAnPWCu7CIYizgDZrV4VtmUZtBis='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)