UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k4bq0cMEkn0qFV9O50gmdWxIRNUvjIjq2+CSymR46ew='
WHERE
key_id = '7d230d52b8ee9f5bb54e1ebadd7263530ca5383c5aefa19f5cd494f17bb700a7'
AND (
token = 'k4bq0cMEkn0qFV9O50gmdWxIRNUvjIjq2+CSymR46ew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)