UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iRkGzk3UpjBrQnBs7Gfp1zIRghivDSf9ikVlQ8f+0A8='
WHERE
key_id = 'b258711c9635021add91f6f03b0ea44002ce2b611155b8cab002f12f5fa15973'
AND (
token = 'iRkGzk3UpjBrQnBs7Gfp1zIRghivDSf9ikVlQ8f+0A8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)