UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QjnxW9V2nCjACaFZ/2FKASpzB9ASytxLDoeUV36w5Ms='
WHERE
key_id = 'f0a4ac76eb26775dadcedf66082b2ab8f6c03804d97f3a78e21e188c5cec4979'
AND (
token = 'QjnxW9V2nCjACaFZ/2FKASpzB9ASytxLDoeUV36w5Ms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)