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