UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3atbNLyn6Estj8GcuJuvXua0vPiXja8KzkzKUCGNT7w='
WHERE
key_id = '3423e852fe02c77a65d75d3e1640d2bbbe6a97eda3fddbbaa576949f8949f3ae'
AND (
token = '3atbNLyn6Estj8GcuJuvXua0vPiXja8KzkzKUCGNT7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)