UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bGJ5mIXb5Ycvel9lPoz7WwkOlqN7pb7pAkV0u+5Xc9U='
WHERE
key_id = '7307f0d0839d4efbfdae68f995081bd65db68c662e21ea8966037827a59c3f9c'
AND (
token = 'bGJ5mIXb5Ycvel9lPoz7WwkOlqN7pb7pAkV0u+5Xc9U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)