UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nzaSAOlaEZWxN0k7Rp1t3YunBYMe0gjcmA45xXP2X50='
WHERE
key_id = '8a712aa4c6550b7b87b7281e047cb44036d88558e084ac46b8e56fb274b5cdb9'
AND (
token = 'nzaSAOlaEZWxN0k7Rp1t3YunBYMe0gjcmA45xXP2X50='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)