UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZK+9U4CZYf3W+8vyETeLQA/RYVgSQvDEKSfRPOnt0WE=' 
WHERE 
  key_id = '4b6974f935ae22754b589abf729944dbf8109961bc561934954368326d4d9f9a' 
  AND (
    token = 'ZK+9U4CZYf3W+8vyETeLQA/RYVgSQvDEKSfRPOnt0WE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020