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