UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hCUg8xXoqS/G3RkKvdUTWqLW/Pdbs1+f/j8qVfiFlBA=' 
WHERE 
  key_id = 'f8e24596696c7fd6ab0d339b444f6337936d157ed0c815436879e6ec17017ed2' 
  AND (
    token = 'hCUg8xXoqS/G3RkKvdUTWqLW/Pdbs1+f/j8qVfiFlBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040