UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'joSZahr0lYrO4/zaJqs5OQwFLZCrjaqarMjYgn1h9vg=' 
WHERE 
  key_id = '8a5325425bf72b0643550b53a73f3f527c4b90d0373fb2b4311e64c6dc609161' 
  AND (
    token = 'joSZahr0lYrO4/zaJqs5OQwFLZCrjaqarMjYgn1h9vg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022