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