UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r+KSW6WZ7bPkGq1yB9xexuxYi4Iu4eeSV317GVrQXJE='
WHERE
key_id = 'f0c2a233d7fb40416cd14f30b493455954501d9d1a0416c803f554034faa78e2'
AND (
token = 'r+KSW6WZ7bPkGq1yB9xexuxYi4Iu4eeSV317GVrQXJE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)