UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QqblCD14baIG9su+CJzbQ4LRIIryQov+j3ss9ZL1X3E='
WHERE
key_id = '78aa3a7f108444ae6420317e9f162ff0cc759a382df557d0fe54d2a92fa2dca5'
AND (
token = 'QqblCD14baIG9su+CJzbQ4LRIIryQov+j3ss9ZL1X3E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)