UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L1TTqqRRLJocbPkP4SngyxcgEpQd+m+SkZF5QdPkx88='
WHERE
key_id = '9fc6dc24040532e1437d1d54eacb102357baefa975df20b6f7ddd7f088c32d87'
AND (
token = 'L1TTqqRRLJocbPkP4SngyxcgEpQd+m+SkZF5QdPkx88='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)