UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd9VDtW7JFq9kv/rUqQWYM7dN3TJBh3gX4nnT7kxqfNo=' 
WHERE 
  key_id = '293d0d3f7357f1715fd883616e2484ec58b799f21fcf1c78a6389253ff284238' 
  AND (
    token = 'd9VDtW7JFq9kv/rUqQWYM7dN3TJBh3gX4nnT7kxqfNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032