UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Lo7BH8MP3lKuWzRqdl0dDNszZbz44WmtHr6XyldsxWQ='
WHERE
key_id = 'f2e8363eb556a1a03741d075e29666cdfc474a885737e23dd0e5297cbcb532d5'
AND (
token = 'Lo7BH8MP3lKuWzRqdl0dDNszZbz44WmtHr6XyldsxWQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)