UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Do82owPJnIIexHUAS+7/+eedBwDD1Iscxde15TfbQ0='
WHERE
key_id = '3095af1a886b7cbfde74b09df5554032673cf82a73be01092244d4a25f6a925e'
AND (
token = '8Do82owPJnIIexHUAS+7/+eedBwDD1Iscxde15TfbQ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)