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