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

Query time 0.00044