UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z0ZPkdduUceIIoExmTLLlU+i41X2v+0IzpZoCskb/2g='
WHERE
key_id = 'dc912f9b4df8cee532e05c1d1cd0fa59fe2a4f208e29e0e8c6c9c2ff539b1513'
AND (
token = 'z0ZPkdduUceIIoExmTLLlU+i41X2v+0IzpZoCskb/2g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)