UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O4N2lkRpt4pIfhamZP4woyN76gD8PNOg8zNT6hM/YD8=' 
WHERE 
  key_id = '361c6775097c51a389fda68c851081d77a9a6904d6620b9428a2aad726c36376' 
  AND (
    token = 'O4N2lkRpt4pIfhamZP4woyN76gD8PNOg8zNT6hM/YD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045