UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FeOEM5C7iT0FTEu7uEM08KtZb0FNGVI0vW0CyG5MvOI=' 
WHERE 
  key_id = '4676719225b780f749532b8c9f03fa7ef3e6d528350761dd12271eca4f37046d' 
  AND (
    token = 'FeOEM5C7iT0FTEu7uEM08KtZb0FNGVI0vW0CyG5MvOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039