UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T1USeA7DycYe+jlhxs1TVTeHMUb3PQjMMTq00FKvyJs='
WHERE
key_id = 'c89f94396b266e68d3fbd821bdaa4fd39dc424f5a1641e179e215c65985de89e'
AND (
token = 'T1USeA7DycYe+jlhxs1TVTeHMUb3PQjMMTq00FKvyJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)