UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LVO251DhgDkNeRIp7Z2AnqcvRPeyNDekUEvIDoG/1+4='
WHERE
key_id = 'b87b07a9f2d2db56b38015bafcae71499379f9a16b2f3050e8a54ce0ff465143'
AND (
token = 'LVO251DhgDkNeRIp7Z2AnqcvRPeyNDekUEvIDoG/1+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)